//
//  gameTipView.m
//  footBoll
//
//  Created by cckv on 2017/10/11.
//  Copyright © 2017年 cckv. All rights reserved.
//

#import "gameTipView.h"
#import "UIView+extension.h"

@interface gameTipView()
@property (weak, nonatomic) IBOutlet UILabel *score;

@property (weak, nonatomic) IBOutlet UIView *view1;
@property (weak, nonatomic) IBOutlet UIView *view2;
@property (weak, nonatomic) IBOutlet UILabel *tip1;
@property (weak, nonatomic) IBOutlet UILabel *tip2;
@property (weak, nonatomic) IBOutlet UILabel *tip3;

@end

@implementation gameTipView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUP];
    }
    return self;
}

-(void)awakeFromNib
{
    [super awakeFromNib];
    
    self.layer.cornerRadius = 10;
    self.layer.masksToBounds = YES;
    
    [self setUP];
}
- (IBAction)left:(id)sender {
    if ([self.delegate respondsToSelector:@selector(chooseLevel)]) {
        
        [self.delegate chooseLevel];
        
    }
}
- (IBAction)midlle:(id)sender {
    if ([self.delegate respondsToSelector:@selector(nextGame)]) {
        [self.delegate nextGame];
    }
}
- (IBAction)right:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickReStart)]) {
        [self.delegate clickReStart];
    }
}

- (void)setUP
{
    self.view2.layer.masksToBounds = YES;
    self.view2.layer.cornerRadius = 4;
    self.view2.layer.borderWidth = 1;
    self.view2.layer.borderColor = [UIColor blackColor].CGColor;
    
    self.tip1.text = NSLocalizedString(@"LEVEL", nil);
    self.tip2.text = NSLocalizedString(@"Folltaball game", nil);
    self.tip3.text = NSLocalizedString(@"Score", nil);
}

-(void)setWin:(BOOL)win
{
    _win = win;
    if (!win) {
        self.midlleBtn.hidden = YES;
        self.score.text = @"0";
    }else{
        self.midlleBtn.hidden = NO;
        self.score.text = @"100";
    }
}

- (void)drawRect:(CGRect)rect
{
//    kScreenW/3*2, 270
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGRect aRect= CGRectMake(80, 0, 445 - 160, 190);
//    CGContextSetRGBStrokeColor(context, 0.6, 0.9, 0, 1.0);
    CGContextSetRGBFillColor(context,1,1,1,1);
//    CGContextSetLineWidth(context, 3.0);
    CGContextAddEllipseInRect(context, aRect); //椭圆
    CGContextDrawPath(context,kCGPathFillStroke);

}
@end
